using Assets.Scripts.GDK;
using SimpleJson;
using System.Collections.Generic;

namespace Brick
{
	public class StorePanelModule : gdk_base_Imodule
	{
		public bool haveBall(int index)
		{
			if (index == 0)
			{
				return true;
			}
			if (GameData.pifuballs == null || GameData.pifuballs == string.Empty)
			{
				return false;
			}
			List<int> list = SimpleJson.SimpleJson.DeserializeObject<List<int>>(GameData.pifuballs);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i] == index)
				{
					return true;
				}
			}
			return false;
		}

		public void OnGavinBall(int index)
		{
			List<int> list = new List<int>();
			if (GameData.pifuballs != null && !(GameData.pifuballs == string.Empty))
			{
				list = SimpleJson.SimpleJson.DeserializeObject<List<int>>(GameData.pifuballs);
			}
			list.Add(index);
			GameData.pifuballs = SimpleJson.SimpleJson.SerializeObject(list);
		}
	}
}

